package swingFiles;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.SwingConstants;
import javax.swing.JButton;

/**
 * Creates the panel for the members of the gym management system.
 * 
 * @author Emily Linniman
 * @version December 1, 2014
 *
 */
@SuppressWarnings("serial")
public class MemberHome extends JPanel {

	/** The frame on which the panel is placed on. */
	private JFrame my_frame;

	/**
	 * Create the frame.
	 */
	public MemberHome(JFrame the_frame) {
		my_frame = the_frame;
		my_frame.setTitle("Member");
		setBackground(Color.ORANGE);
		my_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		setLayout(null);
		
		JLabel lblWelcomeMember = new JLabel("Welcome, Member!");
		lblWelcomeMember.setBounds(57, 5, 156, 22);
		lblWelcomeMember.setHorizontalAlignment(SwingConstants.CENTER);
		lblWelcomeMember.setFont(new Font("Arial", Font.PLAIN, 18));
		add(lblWelcomeMember);
		
		JLabel registeredClassesLabel = new JLabel("Your Registered Classes:");
		registeredClassesLabel.setBounds(6, 39, 168, 18);
		add(registeredClassesLabel);
		registeredClassesLabel.setFont(new Font("Arial", Font.PLAIN, 15));
		
		JTextArea textbox = new JTextArea();
		textbox.setBounds(6, 290, 190, -215);
		add(textbox);
//		List<Class> classes = db.getMemberClasses(id);
		
		JButton registerButton = new JButton("Register for a Class");
		registerButton.setBounds(241, 82, 174, 29);
		add(registerButton);
		registerButton.setFont(new Font("Arial", Font.PLAIN, 15));
		
		JButton btnLeaveAReview = new JButton("Leave a Review");
		btnLeaveAReview.setBounds(242, 138, 174, 29);
		add(btnLeaveAReview);
		btnLeaveAReview.setFont(new Font("Arial", Font.PLAIN, 15));
		
		JButton logoutButton = new JButton("Logout");
		logoutButton.setBounds(243, 196, 168, 29);
		logoutButton.setFont(new Font("Arial", Font.PLAIN, 15));
		logoutButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				my_frame.setContentPane(new LogIn(my_frame));
				my_frame.validate();
				my_frame.setVisible(true);
			}
		});
		add(logoutButton);
	}
}
